
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="yes" name="apple-touch-fullscreen">
    <meta content="telephone=no" name="format-detection">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1;user-scalable=no;">
    <title>1起购</title>
    <link rel="stylesheet" href="/statics/view/css/bootstrap.css">
    <link rel="stylesheet" href="/statics/view/css/style.css">
    <link rel="stylesheet" href="/statics/view/css/member.css">
    <link rel="stylesheet" href="/statics/view/css/order3.css">
    <script charset="utf-8" src="/statics/view/js/jquery.min.js"></script>
    <script charset="utf-8" src="/statics/view/js/global.js"></script>
    <script charset="utf-8" src="/statics/view/js/bootstrap.min.js"></script>
    <script charset="utf-8" src="/statics/view/js/template.js"></script>
    <script src="/statics/jquery/jquery.validate.js"></script>
    <script type='text/javascript' src="/statics/view/js/jquery.form.js"></script>
    <script type="text/javascript" src="/statics/layer.m/layer.m.js"></script>

    <style type="text/css">
        .details_con li .tb-out-of-stock{
            border: 1px dashed #bbb;
            color:#bbb;
            cursor: not-allowed;
        }
        .no-selected{
            background: #ffe8e8 none repeat scroll 0 0;
            border: 2px solid #be0106;
            margin: -1px;
        }
        /*动态返回顶部*/
        .fixed_box { position: fixed; bottom: .5rem; right: .5rem;display: none; }
    </style>
</head>
<body style="background-color:#fff">
<div class="fanhui_cou">
    <div class="fanhui_1"></div>
    <div class="fanhui_ding">顶部</div>
</div>
<div class="maincontainer">
    <div class="container wx_wrap mini-innner">
        <div class="row">
            <header class="header">
                <div class="fix_nav">
                    <div style="max-width:768px;margin:0 auto;background:#db3652;position: relative;">
                        <a class="nav-left back-icon" href="javascript:history.back();">返回</a>

                        <div class="tit">变更地址</div>
                        <a class="nav-right icon-home" href="/dbs/index.html">首页</a>
                    </div>
                </div>
            </header>
        </div>
        <div class="row">
            <div class="col-md-12">
                <form action="update" method="POST" onsubmit="return formValidate(this)">
                    <input type="hidden"  id="id" name="id" value="${entity.id}">
                    <div class="reg_login">
                        <ul style="color:#000;"><style>ul li{margin: 5px auto;}</style>
                            <li><input type="text" name="consignee" id="consignee" class="required required_3" placeholder="请填写收件人" value="${entity.consignee}" errormsg="请填写1~16位中文姓名" datatype="c16" /></li>
                            <li><input type="tel" name="phone" id="phone" class="required required_3" placeholder="请填写电话号码" value="${entity.phone}" maxlength="11"></li>
                            <li><span>地区信息</span><p>
                                <select name="province" id="province"  style="width:26%;height:40px;padding-left:10px;color:#000" ></select>&nbsp;
                                <select name="city" id="city"  style="width:26%;height:40px;padding-left:10px;color:#000"></select>&nbsp;
                                <select name="district" id="district" style="width:26%;height:40px;padding-left:10px;color:#000"> </select>&nbsp;
                            </p></li>
                            <li><input type="text" name="address" id="address" value="${entity.address}" class="required required_3" placeholder="请填写详细地址" maxlength="55" ></li>
                            <li><input type="text" name="zipCode" id="zipCode" class="required required_3" placeholder="请填写邮编" value="${entity.zipCode}"/></li>
                        </ul>
                    </div>
                    <input id="addressSub" type="submit"  class="btn btn-success btn-block" data-istempuser="false" data-loading-text="正在提交..." value="确定">

                </form>
            </div>
        </div>
    </div>
    <div class="clear"></div>
</div>
<script type="text/javascript">
    $(function(){

        $("select[name='province']").change(function(){
            var pId=$(this).find("option:selected").val();
            $("#city").html("0");
            $("#district").html("0");
            loadChild("#city",pId);
        });

        $("select[name='city']").change(function(){
            var pId=$(this).find("option:selected").val();
            $("#district").html("0");
            loadChild("#district",pId);
        });
    });

    init(${provinceAreaId},${cityAreaId},${districtAreaId});
    function init(provinceId,cityId,districtId){
        loadChild("#province","",provinceId);
        loadChild("#city",provinceId,cityId);
        if(districtId!=0){
            loadChild("#district",cityId,districtId);
        }
    }
    function loadChild(optWrapDom,parentId,selectId){
        $.ajax({
            url: "/area/getJsonArea",
            type: "GET",
            data: {
                parentId: parentId
            },
            dataType: "json",
            cache: false,
            success: function (data) {
                if (data.type == 'success') {
                    var optionHtml = "<option value='0'>所有</option>";
                    $(data.list).each(function (index, entity) {
                        if(entity.id==selectId){
                            optionHtml = optionHtml + "<option value='" + entity.id + "' selected='selected'>" + entity.name + "</option>"
                        }else{
                            optionHtml = optionHtml + "<option value='" + entity.id + "'>" + entity.name + "</option>"
                        }
                    });
                    $(optionHtml).appendTo(optWrapDom);
                }
            }
        });
    }

    function formValidate(form){
        var $form = $(form);
        if (!$form.valid()) {
            return false;
        }
        $.ajax({
            type: form.method || 'POST',
            url:$form.attr("action"),
            data:$form.serializeArray(),
            dataType:"json",
            cache: false,
            success: function(data){
                if(data.type=='success'){
                [#if redirectUrl??]
                    location.href = "${redirectUrl}";
                [#else]
                    location.href = "/member/receiver/list?tag=${tag}";
                [/#if]
                }else{
                    layer.open({
                        content: message.content,
                        time: 2
                    });
                }
            }
        });
        return false;
    }
</script>
</body>
</html>

